#ifndef CONTAINER_PROTOTYPE
#define CONTAINER_PROTOTYPE

#include "../general/generalPrototype.hpp"

struct ContainerHolderSlave :GeneralSlave {
	struct SampleContainer {
		std::wstring type;
		std::wstring referenceName;
		std::wstring volumeUnit;
		int isLoaded = 0;
		struct SampleSlot {
			// <0 for the container or anythin
			int virtualIdx;
			int threshold;
			int rawReading;
			int isOccupied;
			int isOccupiedDifferent;
			int toStr(int indent);
		};
		int containerIdx;
		std::vector<SampleSlot> slots;

		void resize(int size);
		int size();
	};

	struct ContainerStatuses {
		std::vector<SampleContainer> containers;

		int readOutVerboseLv = 1;
		int readOutLayerIdx = 0;
		int readOutPosIdx = 0;

		void resize(int containerNum, int splNumPerContainer);
		void forceUpdateAll();
		void restartReadout();
		// always readout the container status first, with posIdx=-1
		int readOut(int* containerIdx, int* posIdx, int* rawReading, int* threshold, int* isOccupied);
		void print();
		void clear();
	}_status;

	virtual int updateHolder() { return -1; };
	int forceUpdateAll();

	// mode==0: all, mode==1: only changed
	virtual int startReadOut(int mode);
	virtual int readOut(int* layerIdx, int* posIdx, int* rawReading, int* threshold, int* isOccupied);

	virtual int configThreshold(int layerIdx, std::wstring name, int posIdx, int newThreshold) { return 0; };

	// for those idx < 0, get the meaning here
	virtual std::wstring getSlotVirtualIndexMeaning(int idx) { return L""; };
	virtual int getSlotSeqIndex(int idx, std::wstring) { return 0; };
};

#endif